package cn.doitedu.javase.io;

import java.io.*;

public class _07_BufferedReader和BufferedWriter基本Api示例 {
    public static void main(String[] args) throws IOException {

        FileWriter fileWriter = new FileWriter("e:/x.txt");
        BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);

        bufferedWriter.write("老夫聊发少年狂");
        bufferedWriter.newLine();
        bufferedWriter.write("左牵黄右擎苍");
        bufferedWriter.flush();

        bufferedWriter.close();

        //---------------
        FileReader fileReader = new FileReader("e:/x.txt");
        BufferedReader br = new BufferedReader(fileReader);


        String line;
        while( (line = br.readLine())!=null ){
            System.out.println(line);
        }

        br.close();
    }
}
